Skip to content

Conversation

@midona-rhel
Copy link
Contributor

@midona-rhel midona-rhel commented Dec 1, 2025

Fix snow appearing on vertical surfaces facing certain directions

Snow projection was comparing model-space and world-space vectors directly, causing inconsistent results based on
object rotation. Some wall-mounted objects (like rugs) would incorrectly show snow depending on which compass
direction they faced.

Fixed by transforming the projection direction to world space before the comparison.

Easiest way I found to replicate this was to download https://www.nexusmods.com/skyrimspecialedition/mods/18223 and create a new character, speedrun into the house and look at the rug facing the east.

Summary by CodeRabbit

  • Rendering
    • Improved texture projection coordinate transformation in shader processing for enhanced visual accuracy.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 1, 2025

Walkthrough

A shader optimization modifies how texture projection coordinates are transformed in the non-skinned PROJECTED_UV rendering path. Instead of directly using projection coordinates, the code now constructs a world-space 3x3 matrix from world axes and multiplies it with the projection vector, altering the orientation transformation.

Changes

Cohort / File(s) Summary
Shader projection coordinate transformation
package/Shaders/Lighting.hlsl
Modified TexProj computation in PROJECTED_UV (non-SKINNED) path to use world-space matrix transformation instead of direct texture projection coordinate usage

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single file modified with focused mathematical transformation
  • Requires understanding of world-space vs. texture-space coordinate systems and their impact on rendering
  • Consider verifying the matrix construction logic and confirming this produces the intended visual/performance results

Possibly related PRs

Suggested reviewers

  • doodlum
  • jiayev
  • Pentalimbed

Poem

🐰 A matrix dance in shader's light,
World-space axes spinning bright!
Projections twist from old to new,
Transforming coordinates through and through. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title 'fix(snow): use world space vectors' directly aligns with the main change: transforming projection direction to world space to fix snow appearing on vertical surfaces.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Using provided base ref: 520945a
Using base ref: 520945a
Base commit date: 2025-12-03T01:43:28-08:00 (Wednesday, December 03, 2025 01:43 AM)
No actionable suggestions for changed features.

@midona-rhel midona-rhel changed the title Updated snow projection to use proper world space vectors fix: Updated snow projection to use proper world space vectors Dec 1, 2025
@midona-rhel midona-rhel marked this pull request as ready for review December 1, 2025 21:06
@github-actions
Copy link

github-actions bot commented Dec 1, 2025

✅ A pre-release build is available for this PR:
Download

@alandtse alandtse changed the title fix: Updated snow projection to use proper world space vectors fix: use world space vectors for snow Dec 2, 2025
@alandtse alandtse changed the title fix: use world space vectors for snow fix(snow): use world space vectors Dec 3, 2025
@alandtse
Copy link
Collaborator

alandtse commented Dec 3, 2025

Please confirm testing results.

@midona-rhel
Copy link
Contributor Author

Please confirm testing results.

I have now confirmed both brendan and mirirs issue is fixed. See the testing thread to replicate the issue, it is fairly simple, the castle you just download and add the modified esp, then go south and check that there is no snow on the walls. For anyone reviewing this see the discord testing release thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants